From 145a5fdc05e8e548c53e82a3a7295081b8c6a3d1 Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
Date: Wed, 3 Aug 2022 00:31:24 +0200
Subject: [PATCH] drop bash usage

---
 conftools/test-driver  |  6 +++++-
 fix-xmltest-log.sh     |  2 +-
 run.sh.in              |  2 +-
 test-driver-wrapper.sh | 15 ++++-----------
 tests/xmltest.sh       |  2 +-
 xmlwf/xmlwf_helpgen.sh |  2 +-
 6 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/conftools/test-driver b/conftools/test-driver
index 9759384..84adea1 100755
--- a/conftools/test-driver
+++ b/conftools/test-driver
@@ -109,7 +109,11 @@ trap "st=143; $do_exit" 15
 # to ameliorate tests themselves also writing to the log file. Our tests
 # don't, but others can (automake bug#35762).
 : >"$log_file"
-"$@" >>"$log_file" 2>&1
+if [ -n "$TEST_SCRIPT" ]; then
+    "$TEST_SCRIPT" "$@" >>$log_file 2>&1
+else
+    "$@" >>$log_file 2>&1
+fi
 estatus=$?
 
 if test $enable_hard_errors = no && test $estatus -eq 99; then
diff --git a/fix-xmltest-log.sh b/fix-xmltest-log.sh
index 164ea4e..4f47f94 100755
--- a/fix-xmltest-log.sh
+++ b/fix-xmltest-log.sh
@@ -1,4 +1,4 @@
-#! /usr/bin/env bash
+#!/bin/sh
 #                          __  __            _
 #                       ___\ \/ /_ __   __ _| |_
 #                      / _ \\  /| '_ \ / _` | __|
diff --git a/run.sh.in b/run.sh.in
index 72f86b6..c131870 100644
--- a/run.sh.in
+++ b/run.sh.in
@@ -1,4 +1,4 @@
-#! /usr/bin/env bash
+#!/bin/sh
 #                          __  __            _
 #                       ___\ \/ /_ __   __ _| |_
 #                      / _ \\  /| '_ \ / _` | __|
diff --git a/test-driver-wrapper.sh b/test-driver-wrapper.sh
index 305c6f5..a42dc6d 100755
--- a/test-driver-wrapper.sh
+++ b/test-driver-wrapper.sh
@@ -1,4 +1,4 @@
-#! /usr/bin/env bash
+#!/bin/sh
 #                          __  __            _
 #                       ___\ \/ /_ __   __ _| |_
 #                      / _ \\  /| '_ \ / _` | __|
@@ -30,15 +30,8 @@
 # USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 set -e
-top_srcdir="$(dirname "$(type -p "$0")")"
+top_srcdir="$(dirname "$(type "$0"|sed 's/.* //')")"
 top_builddir=..
 
-# Suck up all dash-dash test-driver arguments
-test_driver_args=()
-while [[ ${1} != '--' ]]; do
-    test_driver_args=( "${test_driver_args[@]}" "${1}" )
-    shift
-done
-shift  # drop "--"
-
-exec "${top_srcdir}"/conftools/test-driver "${test_driver_args[@]}" "${top_builddir}"/run.sh "$@"
+export TEST_SCRIPT="${top_builddir}/run.sh"
+exec "${top_srcdir}"/conftools/test-driver "$@"
diff --git a/tests/xmltest.sh b/tests/xmltest.sh
index dc409d0..0a05e12 100755
--- a/tests/xmltest.sh
+++ b/tests/xmltest.sh
@@ -1,4 +1,4 @@
-#! /usr/bin/env bash
+#!/bin/sh
 # EXPAT TEST SCRIPT FOR W3C XML TEST SUITE
 #
 # This script can be used to exercise Expat against the
diff --git a/xmlwf/xmlwf_helpgen.sh b/xmlwf/xmlwf_helpgen.sh
index 864e470..a4af3f6 100755
--- a/xmlwf/xmlwf_helpgen.sh
+++ b/xmlwf/xmlwf_helpgen.sh
@@ -1,4 +1,4 @@
-#! /usr/bin/env bash
+#!/bin/sh
 #                          __  __            _
 #                       ___\ \/ /_ __   __ _| |_
 #                      / _ \\  /| '_ \ / _` | __|
-- 
2.37.1

